<template>
  <div class='search'>
    <f-form ref='saleManForm' :action='api.saleMan.updateAmount' :form-key='this.formItem.saleManId'>
      <f-form-item label='姓名' name='saleManName' :value='formItem.saleManName' disabled :required='true' />
      <f-form-item label='资信额度' name='reputationAmount' type='number' :precision='2' data-type='number' :value='formItem.reputationAmount' />
      <f-form-item label='资信天数' name='reputation' type='number' :precision='0' data-type='number' :value='formItem.reputation' />
      <f-form-item label='资保金余额' name='amount' type='number' :precision='2' data-type='number' :value='formItem.amount' />
    </f-form>
  </div>
</template>
<script>
import api from "../js/api"
import SelectDeptManModal from "@/views/module/haiying/components/select_deptman_modal"

export default {
  name: "salemanSimpleForm",
  props: {},
  watch: {
    "formItem.deptId"(newVal) {

    }
  },
  data() {
    return {
      refs: this.$refs,
      areaIds: null,
      api: Object.assign(api, this.api),
      isAdd: true,//是否是添加模式
      autoLoad: false,
      loadSaleManParams: {
        saleManType: 1
      },
      loaded: false,//是否加载完成
      formItem: this.getFormItem(),
      queryParam: {
        isFlp: 1
      }
    }
  },
  methods: {
    getFormItem() {
      return {
        saleManId: "",
        saleManName: "",
        amount: 0,
        reputation: 0,
        reputationAmount: 0

      }
    },
    //表单赋值
    setData(data) {
      this.formItem = data
      if (data && data.saleManId) {
        let params = {
          id: data.saleManId
        }
        this.http.get(this, {
          url: this.api.saleMan.get,
          params: params,
          success: (me, data) => {
            this.formItem = data
            this.loaded = true
          }
        })
        this.isAdd = false
      } else {
        this.formItem = this.getFormItem()
        this.areaIds = []
        this.loaded = true
      }
    },
    //提交表单
    handleSubmit(callback) {
      this.$refs.saleManForm.submit({
        saleManType: 1,
        saleManId: this.formItem.saleManId,
        companyId: 5
      }, callback)
    }
  },
  created() {

  },
  components: { SelectDeptManModal }
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
